package cn.shengchao.examstar.shared.domain.ai.vo;

import cn.shengchao.examstar.shared.domain.valueobject.ValueObject;
import lombok.Getter;
import org.springframework.util.Assert;

import java.util.Objects;

/**
 * 掌握程度值对象
 */
@Getter
public class DegreeOfMastery extends ValueObject {
    /**
     * 掌握程度百分比
     */
    private final Double percentage;

    /**
     * 掌握程度描述
     */
    private final String description;

    public DegreeOfMastery(Double percentage, String description) {
        Assert.notNull(percentage, "Percentage cannot be null.");
        Assert.isTrue(percentage >= 0 && percentage <= 100, "Percentage must be between 0 and 100.");
        this.percentage = percentage;
        this.description = description;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DegreeOfMastery that = (DegreeOfMastery) o;
        return Objects.equals(percentage, that.percentage);
    }

    @Override
    public int hashCode() {
        return Objects.hash(percentage);
    }
} 